package priv.xml;



import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
//import org.springframework.context.support.ClassPathXmlApplicationContext;

@Configuration
@ImportResource(locations= "classpath:application.cfg.xml")
public class Demo4Xml {
@SuppressWarnings("resource")
	public static void main(String[] args) {
		ApplicationContext context = new AnnotationConfigApplicationContext(Demo4Xml.class);
				//new ClassPathXmlApplicationContext("application.cfg.xml");
		Date bean = (Date) context.getBean("hongkong_back_day");
		System.out.println(bean);
		
		Person bean2 = context.getBean(Person.class);
		System.out.println(bean2);
		
		System.out.println(context.getBean(Cat.class));
		
		System.out.println(context.getBean(SimpleDateFormat.class).format(bean));
		
		System.out.println(context.getBean(Calendar.class).getClass());
		
		System.out.println(context.getBean(MouMou.class));
	}

}
